<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>中国福利彩票</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

<!--页面样式-->
<link rel="stylesheet" type="text/css" href="css/style.css" />

</head>
<body  style="width:10rem !important; margin:0 auto">
<script>
/*取设备宽度*/
	function rem(){
	var iWidth=document.documentElement.getBoundingClientRect().width;
	iWidth=iWidth>640?640:iWidth;
	document.getElementsByTagName("html")[0].style.fontSize=iWidth/10+"px";
	};
	rem();
	window.onorientationchange=window.onresize=rem      
</script>
<script src="js/jquery-1.7.2.min.js"></script>
	<div class="Header">
<!--     	<div class="left H_logot"><a href="MemberCenter.html"><img src="images/Nimg5.png"></a></div> -->
        <div class="left H_content text-center font28 cfffff">手机号变更</div>
        <div class="right H_right text-right font24"><a href="MemberCenter.html"><img src="images/Nimg4.png"></a></div>
        <div class="clear"></div>
    </div>
    
    <div class="Forgetpwd">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="2">
            	<div class="FPWD_li">
                	<dl>
                    	<dt><img src="images/Fimg1.png"></dt>
                        <dd><input type="text" class="DT_text1 font28 c666666 Weiruan" placeholder="新手机号" id="newPhoneNum" maxlength="11"></dd>
                        <div class="clear"></div>
                    </dl>
                </div>
            </td>
          </tr>
          <tr>
            <td>
           	  <input type="text" class="DT_text2 font28 c666666 Weiruan marginT20" placeholder="验证码" id="smsCode" maxlength="8">
            </td>
            <td align="right">
            	<input type="button" id="smsCodeBtn" value="获取验证码" class="FPWD_yan font28 cfffff Weiruan marginT20" onclick="getVerificationCode()">
            </td>
          </tr>
          <tr>
            <td colspan="2">
            	<input type="submit" value="完 成" class="FPWD_but font32 cfffff Weiruan marginT80"  onclick="sureBtn()" />
            </td>
          </tr>
        </table>
    </div>
	<!-- 弹出alert -->
	<div class="falert" style="display: none;" id="warnInfoDiv">
		<div class="falert_t font30">
			<span style="margin-left: 0.15rem">提示</span>
		</div>
		<div class="falert_b">
			<span id="warnInfo"></span><img class="dianji_gb"
				style="position: absolute; right: 0.1rem; top: 0.15rem; cursor: pointer;"
				width="45rem" src="images/Fimg8.png"
				onclick="closeWarnInfoDiv('warnInfoDiv')" />
		</div>
	</div>
	<!-- 弹出alert -->
</body>
<script type="text/javascript">
	var accountId = "";
	var token = "";
	var channelId = "";
	jQuery(document).ready(function($) {
		accountId = getCookie("accountId");
		token = getCookie("token");
		channelId = getCookie("channelId");
	});
	//获得“短信验证码”
	function getVerificationCode() {
		//验证手机号格式
		if (!validatePhoneNum('newPhoneNum')) {
			return;
		}
		var para = {
			mobile : $('#newPhoneNum').val(),
			type : 2
		};
		$.ajax({
			url : "../../api/accountSystem/verification/msgcode",
			async : false,
			type : "POST",
			herder : {
				'Accept' : 'application/json',
				'Content-Type' : 'application/json'
			},
			dataType : "json",
			contentType : "application/json",
			data : JSON.stringify(para),
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert(errorThrown);
			},
			success : function(data, textStatus) {
				if(data.success==true){
					messageCodeTime('smsCodeBtn');
				}else{
					alert(data.description);
				}
			}
		});
	}
	
	function sureBtn(){
		//验证银行卡号
		if(!validatePhoneNum('newPhoneNum')){
			return;
		}
	  var para = {
			  	accountId:accountId,
			  	mobile:$("#newPhoneNum").val(),
				smsCode:$("#smsCode").val(),
				token:token,
				channelId:channelId
	        };
		
		$.ajax({
			url : "../../api/accountSystem/account/phonechange",
			async:false,
			type : "POST",
			herder:{
				'Accept':'application/json',
				'Content-Type':'application/json'
			},
			dataType:"json",
			contentType:"application/json",
			data: JSON.stringify(para),
			error:function(XMLHttpRequest, textStatus, errorThrown){
				alert(errorThrown);
			},
			success: function(data, textStatus){
				if(data.success == true){
					window.location.href='MobileWin.html';
				}else{
					window.location.assign(encodeURI('MobileDown.html?description='+data.description+''));
					return;
				}
			}		
		});
	}
</script>
<script src="js/jsCallCookies.js"></script>
<script src="js/validation.js"></script>
<script src="js/countDown.js"></script>
<script src="js/common.js"></script>
</html>
